1 <?
2 $path =
"../album/pictures";
3 $pathdb =
"../album/pictures";
4
5 if
(isset($_POST['butSaveLoai'])) {
6     $name=$_POST[
'txtName'];
7     $desc=$_POST[
'txtShortDesc'];
8     $status=($_POST[
'chkShow']!=''?1:0);
9     $categories_id=$_POST[
'ddCat'];
10
11     $imagelarge=$_FILES[
'txtImageLarge'];
12     $imageSmall=$_FILES[
'txtImage'];
13             
14     $err=
"";
15     
if ($name=="") $err .= "Xin nh&#7853;p tên hình <br>";
16     $err.=CheckUpload($_FILES[
"txtImage"],".jpg;.gif;.bmp",500*1024,$_POST['id']==''?1:0);
17     $err.=CheckUpload($_FILES[
"txtImageLarge"],".jpg;.gif;.bmp",500*1024,0);
18
19     
if ($err=='')
20     {
21     
if (!empty($_POST['id'])) {
22             $oldid = $_POST[
'id'];
23             $sql =
"update album_images set album_images_name='".$name."',album_images_description='".$desc."',album_images_status='".$status."',album_images_categoriesid='".$categories_id."' where album_images_id='".$oldid."'";
24         }
else {
25             $sql =
"insert into album_images (album_images_name,album_images_description,album_images_status,album_images_dateadded,album_images_categoriesid) values ('".$name."','".$desc."','".$status."',SYSDATE(),'".$categories_id."')";
26         }
27         
if (mysql_query($sql,$con)) {
28             
if(empty($_POST['id'])) $oldid = mysql_insert_id();
29         
30             $sqlUpdateField =
"";
31             
32             $extsmall=GetFileExtention($_FILES[
'txtImage']['name']);
33             
if (MakeUpload($_FILES['txtImage'],"$path/album_s$oldid$extsmall"))
34             {
35                 @chmod(
"$path/album_s$oldid$extsmall", 0777);
36                 $sqlUpdateField =
" album_images_img='$pathdb/album_s$oldid$extsmall' ";
37             }
38
39             $extlarge=GetFileExtention($_FILES[
'txtImageLarge']['name']);
40             
if (MakeUpload($_FILES['txtImageLarge'],"$path/album_l$oldid$extlarge"))
41             {
42                 @chmod(
"$path/album_l$oldid$extlarge", 0777);
43                 
if($sqlUpdateField != "") $sqlUpdateField .= ",";
44                 $sqlUpdateField .=
" album_images_imglarge='$pathdb/album_l$oldid$extlarge' ";
45             }
46             
if($sqlUpdateField!='')
47             {
48                 $sqlUpdate =
"update album_images set $sqlUpdateField where album_images_id='".$oldid."'";
49                 mysql_query($sqlUpdate,$con);
50             }
51         }
52
53         
else {
54             $err =
"Không th&#7875; c&#7853;p nh&#7853;t";
55         }
56     }

57
58 if
($err=='') echo '<script>window.location="index.php?act=album_image&page='.$_REQUEST['page'].'&code=1"</script>';
59     
else echo "<p align=center class='err'>".$err."</p>";
60 }
else {
61 ?>
62
63 <?
64     
if (isset($_GET['id'])) {
65         $oldid=$_GET[
'id'];
66         $page = $_GET[
'page'];
67         $sql =
"select * from album_images where album_images_id='".$oldid."' limit 1";
68         
if ($result = mysql_query($sql,$con)) {
69             $row=mysql_fetch_array($result);
70             $name=$row[
'album_images_name'];
71             $desc=$row[
'album_images_description'];
72             $image=$row[
'album_images_img'];
73             $imagelarge=$row[
'album_images_imglarge'];
74             $status=$row[
'album_images_status'];
75             $categories_id = $row[
'album_images_categoriesid'];
76         }
77     }
78 }
79
80 ?>
81
82 <form method=
"post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php">
83 <input type=
"hidden" name="act" value="album_image_m">
84 <input type=
"hidden" name="page" value="<? echo $_REQUEST['page']; ?>">
85 <input type=
"hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
86 <?

87 if
($image!='')
88 {
89 ?>
90 <table cellspacing=
"0" cellpadding="0" width="100%">
91 <tr>
92     <td align=
"center">
93     <img border=
"0" src="<? echo $image; ?>">
94     </td>
95 </tr>
96 </table>
97 <?
98 }
99 ?>
100
101 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
102   <tr>
103     <td width=
"45%" class="title" align="center" height="20">Thêm m&#7899;i / C&#7853;p nh&#7853;t
104     : Hình &#
7843;nh</td>
105   </tr>
106   <tr>
107     <td width=
"45%">
108     <table border=
"0" cellpadding="2" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
109       <tr>
110         <td width=
"15%" class="smallfont">
111         <p align=
"right">Tên hình</td>
112         <td width=
"1%" class="smallfont" align="center">
113         &nbsp;</td>
114         <td width=
"83%" class="smallfont">
115         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
116       </tr>
117       <tr>
118         <td width=
"15%" class="smallfont">
119         <p align=
"right">Hình &#7843;nh (kích th&#432;&#7899;c nh&#7887;)</td>
120         <td width=
"1%" class="smallfont" align="center">
121         <font color=
"#FF0000">*</font></td>
122         <td width=
"83%" class="smallfont">
123         <INPUT TYPE=
"file" NAME="txtImage" CLASS=textbox size="34"></td>
124       </tr>
125       <tr>
126         <td width=
"15%" class="smallfont">
127         <p align=
"right">Hình &#7843;nh (kích th&#432;&#7899;c l&#7899;n)</td>
128         <td width=
"1%" class="smallfont" align="center">
129         &nbsp;</td>
130         <td width=
"83%" class="smallfont">
131         <INPUT TYPE=
"file" NAME="txtImageLarge" CLASS=textbox size="34"></td>
132       </tr>
133             <tr>
134         <td width=
"15%" class="smallfont" align="right">
135         Thu&#
7897;c danh m&#7909;c</td>
136         <td width=
"1%" class="smallfont" align="center">
137         &nbsp;</td>
138         <td width=
"83%" class="smallfont">
139         <
select size="1" name="ddCat">
140 <?
141         
//echo "<option value='0'>[Danh m&#7909;c g&#7889;c]</option>";
142         $cats=GetListProduct();
143         
foreach ($cats as $cat)
144         {
145             
if ($cat[0]==$categories_id)
146                 echo
"<option value=".$cat[0]." selected>".$cat[1]."</option>";
147             
else
148                 echo
"<option value=".$cat[0].">".$cat[1]."</option>";
149         }
150 ?>
151         </
select></td>
152       </tr>
153
154       <tr>
155         <td width=
"15%" class="smallfont" align="right">
156         Không cho hi&#
7879;n</td>
157         <td width=
"1%" class="smallfont" align="center">
158         &nbsp;</td>
159         <td width=
"83%" class="smallfont">
160         <input type=
"checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
161       </tr>
162       <tr>
163         <td width=
"15%" class="smallfont">
164         <p align=
"right">
165         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button align=right>&nbsp;</td>
166         <td width=
"1%" class="smallfont" align="center">
167         &nbsp;</td>
168         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
169       </tr>
170     </table>
171     </td>
172   </tr>
173   </table>
174 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.835 lượt xem

Gõ tìm kiếm nhanh...